package com.ruoyi.web.controller.edh;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.edh.domain.EdhIssueReply;
import com.ruoyi.edh.domain.model.EdhIssueReplyModel;
import com.ruoyi.edh.service.IEdhIssueReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 易订货-学院发布内容回复Controller
 *
 * @author xxx
 * @date 2020-09-02
 */
@RestController
@RequestMapping("/edh/issuereply")
@Api(description = "易订货-学院发布内容回复管理")
public class EdhIssueReplyController extends BaseController {
    @Autowired
    private IEdhIssueReplyService edhIssueReplyService;

    /**
     * 新增易订货-学院发布内容回复
     */
    @Log(title = "易订货-学院发布内容回复", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增易订货-学院发布内容回复")
    public AjaxResult add(@Validated @RequestBody EdhIssueReplyModel edhIssueReply) {
        return toAjax(edhIssueReplyService.insertEdhIssueReply(edhIssueReply));
    }

    /**
     * 修改易订货-学院发布内容回复
     */
    @Log(title = "易订货-学院发布内容回复", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改易订货-学院发布内容回复")
    public AjaxResult edit(@RequestBody EdhIssueReply edhIssueReply) {
        return toAjax(edhIssueReplyService.updateEdhIssueReply(edhIssueReply));
    }

    /**
     * 删除易订货-学院发布内容回复
     */
    @PreAuthorize("@ss.hasPermi('system:reply:remove')")
    @Log(title = "易订货-学院发布内容回复", businessType = BusinessType.DELETE)
    @DeleteMapping
    @ApiOperation("删除发布内容回复")
    public AjaxResult remove(Long[] ids) {
        return toAjax(edhIssueReplyService.deleteEdhIssueReplyByIds(ids));
    }
}
